#include<iostream>
using namespace std;
#include<time.h>
#include<sys/types.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<error.h>
#include<errno.h>
#include<cstring>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<cstring>
#include<string>
#include<cassert>
#include "Log.hpp"

#define PATH_NAME "/home/zsh/linux/vscode/11-11-shm+fifo"
#define PROJ_ID 0x648
#define MEM_SIZE 4096
#define FIFO_FILE ".fifo"

key_t CreatKey()
{
    key_t key=ftok(PATH_NAME,PROJ_ID);
    if(key<0)
    {
        cerr<<"ftok: "<<strerror(errno)<<endl;
        return 1;
    }
    return key;
}
void CreatFifo()
{
    //umask(0);
    if(mkfifo(FIFO_FILE,0666)<0)
    {
        Log()<<"mkfifo: "<<strerror(errno)<<endl;
        exit(2);
    }
}
#define READER O_RDONLY
#define WRITER O_WRONLY

int Open(const char* filename,int flags)
{
    cout<<"666666666666665757"<<endl;
    return open(filename,flags);
}

ssize_t Wait(int fd)
{
    uint32_t values=0;
    ssize_t s=read(fd,&values,sizeof(values));
    return s;
}
void Signal(int fd)
{
    uint32_t cmd=1;
    write(fd,&cmd,sizeof(cmd));
}
void Close(int fd,const char* fifoname)
{
    close(fd);
    unlink(fifoname);
}